#简单工厂模式
from abc import ABCMeta, abstractmethod
class Operation():
    __metaclass__ = ABCMeta

    def __init__(self):
        self.result = None

    @abstractmethod
    def get_result(self):
        pass


class AddOperation(Operation):

    def get_result(self, number_a, number_b):
        self.result = number_a + number_b
        return self.result


class SubOperation(Operation):

    def get_result(self, number_a, number_b):
        self.result = number_a - number_b
        return self.result


class MulOperation(Operation):

    def get_result(self, number_a, number_b):
        self.result = number_a * number_b
        return self.result


class DivOperation(Operation):

    def get_result(self, number_a, number_b):
        if number_b == 0:
            print("With operator '/', the second number can not be zero.")
            return self.result
        self.result = number_a / number_b
        return self.result

class OperationFactory():

    @classmethod
    def create_operate(self, operator):
        oper = None
        if operator == "+":
            oper = AddOperation()
        elif operator == "-":
            oper = SubOperation()
        elif operator == "*":
            oper = MulOperation()
        elif operator == "/":
            oper = DivOperation()
        else:
            print("Wrong operator.")
        return oper
number_a = int(input("input a number:"))
operator = str(input("input a operater(+ - * /):"))
number_b = int(input("input a number:"))

oper = OperationFactory.create_operate(operator)
print(oper.get_result(number_a, number_b))